

exports.checkUndefine = function (param) {
    if (typeof(param) === "undefined") {
        var err = new Error("Parameter error");
        throw err;
    }
};

exports.JSONSuccess = function (key, value) {
    var response =   {
        "status": 10000,
        "message": "success"
    };

    response[key] = value;

    return JSON.stringify(response);
};

exports.JSONError = function (logger, errCode, msg) {
    var response =   {
        "status": 0,
        "message": "",
        "data": {}
    };
    logger.error("%d, %s", errCode, msg);

    response.state = errCode;
    response.message = msg;

    return JSON.stringify(response);
};
